package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;
import jtk.project4.fleet.domain.MiscExp;




public class MiscExpDao extends IbatisDao{
	
	public List selectMiscExp() throws SQLException {
		List selectMiscExp = null;
			selectMiscExp =getSqlMap().queryForList("SELECT_ALL_MISCEXP", null);
		return selectMiscExp;
	} 

	public int deleteMiscExp(MiscExp misc_exp) throws SQLException{
		return (int) getSqlMap().delete("DELETE_MISCEXP", misc_exp);
	}
	
	public int updateMiscExp(MiscExp misc_exp) throws SQLException{
		return (int) getSqlMap().update("UPDATE_MISCEXP", misc_exp);
	}
	
	public MiscExp insertMiscExp(MiscExp misc_exp) throws SQLException{
		return (MiscExp) getSqlMap().insert("INSERT_MISCEXP", misc_exp);
	}
	
		
	public static void main (String args[]) throws SQLException{
		
		MiscExp misc_exp;
		misc_exp = new MiscExp();
		misc_exp.setCostCenter(13);
		//new MiscExpDao().insertMiscExp(misc_exp);
		
		new MiscExpDao().insertMiscExp(misc_exp); 
		System.out.println("Cost Center dengan nilai : "+misc_exp.getCostCenter()+ " telah di insert pada DB");
		
		/*misc_exp = (MiscExp) new MiscExpDao().selectMiscExp(); 
		System.out.println("Vendor dengan nama ="+misc_exp.getNotes()+ " ,telah di dapat pada dari DB dengan id ="+ misc_exp.getCostCenter());*/
	}
	
}